package com.itheima.map;

import java.util.HashMap;
import java.util.Map;

public class Demo2 {
    public static void main(String[] args) {
        Map<String,String> m = new HashMap<>();
        m.put("郭靖","黄蓉");
        m.put("杨过","小龙女");
        m.put("张无忌","周芷若");

        m.put("张无忌","赵敏");
        System.out.println(m);
        System.out.println("----------");
        m.remove("杨过");
        System.out.println(m);
        System.out.println("----------");
        boolean key1 = m.containsKey("张无忌");
        System.out.println("key = " + key1);
        boolean key2 = m.containsKey("尹志平");
        System.out.println("key2 = " + key2);
        boolean keys = m.containsValue("灭绝师太");
        System.out.println("keys = " + keys);
        int size = m.size();
        System.out.println("size = " + size);
        boolean result = m.isEmpty();
        System.out.println("result = " + result);
        m.clear();
        boolean result2 = m.isEmpty();
        System.out.println("result2 = " + result2);
    }
}
